home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / snpd1292.zip / CCOMCALL.C < prev    next >
C/C++ Source or Header  |  1992-12-26  |  666b  |  37 lines

  1. /*
  2. **  Call undocumented Int 2Eh to invoke COMMAND.COM
  3. **
  4. **  demo by Bob Stout
  5. **
  6. **  NOTES: Dangerous code - will abort batch files in progress and
  7. **         occasionally have other undesirable effects.
  8. **
  9. **         Requires INT2E.ASM
  10. */
  11.  
  12. #include <string.h>
  13. #include <stdlib.h>
  14.  
  15. extern void _Int_2E();
  16.  
  17. void C_Com_Call(char *string)
  18. {
  19.         char *buf;
  20.  
  21.         buf = (char *)malloc(strlen(string) + 3);
  22.         strcat(strcpy(&buf[1], string), "\r");
  23.         buf[0] = (char)strlen(&buf[1]);
  24.         _Int_2E(buf);
  25.         free(buf);
  26. }
  27.  
  28. #ifdef TEST
  29.  
  30. void main(int argc, char *argv[])
  31. {
  32.         C_Com_Call(argv[1]);
  33. }
  34.  
  35. #endif
  36.  
  37.